package ncov.service.impl;

import ncov.dao.StaffDao;
import ncov.model.Staff;
import ncov.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author WuChangJian
 * @date 2020/6/7 10:11
 */
@Service
@Transactional
public class StaffServiceImpl implements StaffService {

    @Autowired
    private StaffDao staffDao;

    @Override
    public Staff getStaffById(Integer id) {
        return staffDao.queryById(id);
    }

    @Override
    public Staff update(Staff oldSf, Staff staff) {
        if (oldSf != null) {
            oldSf.setName(staff.getName());
            oldSf.setEmail(staff.getEmail());
            oldSf.setPhone(staff.getPhone());
            staffDao.update(oldSf);
        }
        return null;
    }
}
